#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i;
  while (scanf("%lld%lld", &n, &k) != EOF) {
    long long a[k + 1];
    vector<pair<long long, long long> > v;
    for (i = 0; i < k; i++) {
      cin >> a[i], v.push_back(make_pair((n % a[i]), i + 1));
    }
    sort(v.rbegin(), v.rend());
    int j = v[k - 1].second;
    cout << j << " " << (n / a[j - 1]) << endl;
  }
  return 0;
}
