#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> v(k);
  for (long long i = 0; i < k; i++) cin >> v[i];
  long long remain = n;
  long long ind = -1;
  for (long long i = 0; i < k; i++) {
    if (n % v[i] < remain) {
      ind = i;
      remain = n % v[i];
    }
  }
  if (ind == -1) {
    cout << 1 << " " << n / v[0];
    return 0;
  }
  cout << ind + 1 << " " << n / v[ind];
  return 0;
}
