#include <iostream>
#include <algorithm>
#define endl '\n'

using namespace std;

int cards[2000];

int main() {
    int s, n;
    cin >> s >> n;

    for (int i = 0; i < n; i++) {
        cin >> cards[i];
    }
    sort(cards, cards + n);

    if (s % cards[n - 1] == 0) {
        cout << s / cards[n - 1];
        return 0;
    }
    else {
        cout << 4;
    }

    return 0;
}

/*

22 5
1 4 8 12 15

*/
