#include <bits/stdc++.h>
using namespace std;
long long n, k;
int main() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  ;
  cin >> n >> k;
  long long a, x = 1000000000000000000, y, z;
  for (long long i = 0; i < k; i++) {
    cin >> a;
    if (x > n % a) {
      x = n % a;
      y = a;
      z = i + 1;
    }
  }
  x = n / y;
  cout << z << " " << x;
  return 0;
}
