#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long n;
int m;
int main() {
  cin >> n >> m;
  int pos;
  long long minr = inf, ans, k;
  for (int i = 1; i <= m; i++) {
    scanf("%I64d", &k);
    long long c = n / k, r = n % k;
    if (r < minr) {
      minr = r;
      ans = c;
      pos = i;
    }
  }
  cout << pos << " " << ans << endl;
  return 0;
}
