#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s, p, k, m;
  map<int, int> A;
  cin >> k >> n;
  long long a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (A[a[i] % k] == 0)
      A[a[i] % k] = 1;
    else {
      cout << i << " ";
      return 0;
    }
  }
  cout << "-1" << endl;
}
