#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, m, i, j, k, sum;
  long long int a[100001];
  cin >> n >> k;
  bool yo = false;
  for (i = 1; i <= k; i++) cin >> a[i];
  sum = LONG_LONG_MAX;
  for (i = 1; i <= k; i++) {
    if (n % a[i] < sum) {
      sum = n % a[i];
      j = i;
      m = n / a[i];
    }
  }
  cout << j << " " << m;
  return 0;
}
