#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long md) {
  long long res = 1;
  x %= md;
  while (y > 0) {
    if (y & 1) res = (res * x) % md;
    x = (x * x) % md;
    y = y >> 1;
  }
  return res % md;
}
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(k);
  for (long long i = 0; i < k; ++i) cin >> v[i];
  vector<long long> left;
  for (long long i = 0; i < k; ++i) {
    left.push_back(n % v[i]);
  }
  long long pos = min_element(left.begin(), left.end()) - left.begin();
  cout << pos + 1 << " " << n / v[pos];
}
