#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k, a = 0, b = 0, c = 0, val;
  cin >> n >> k;
  for (int i = 1; i <= k; i++) {
    cin >> val;
    long long num = n / val * val;
    if (num > b * c) {
      a = i;
      b = n / val;
      c = val;
    }
  }
  if (a == 0) a = 1;
  cout << a << ' ' << b << endl;
  return 0;
}
