#include <bits/stdc++.h>
using namespace std;
long long a[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k, max = -1, box = 1, howmany = 0;
  cin >> n >> k;
  for (long long i = 0; i < k; i++) cin >> a[i];
  for (long long i = 0; i < k; i++) {
    if ((n / a[i]) * a[i] > max) {
      max = (n / a[i]) * a[i];
      box = i + 1;
      howmany = n / a[i];
    }
  }
  cout << box << " " << howmany << endl;
  return 0;
}
