#include <bits/stdc++.h>
using namespace std;
long long n;
int k;
long long a[100050];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= k; i++) cin >> a[i];
  long long A = 1, B = 0, C = 0;
  for (int i = 1; i <= k; i++) {
    if (n - n % a[i] > C) {
      A = 1ll * i, B = n / a[i];
      C = n - n % a[i];
    }
  }
  cout << A << " " << B;
  return 0;
}
