#include <bits/stdc++.h>
using namespace std;
long long i, j, q;
long long n, m, p, k, t, s, h;
long long a, b, c, d;
long long x, y, z, l, r;
long long one = 1, zero = 0, ans = 0;
long long mod = 1000000007;
long long a1, a2, a3, a4, a5, a6;
string st1, st2, st3;
char ch1, ch2, ch3;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  ifstream fin("Text.txt");
  cin >> n >> k;
  ans = 2000000000000000000;
  for (i = 0; i < k; i++) {
    cin >> a;
    b = n / a;
    if (n - b * a < ans) {
      ans = n - b * a;
      a1 = i + 1;
      a2 = b;
    }
  }
  if (ans != 2000000000000000000) {
    cout << a1 << " " << a2 << endl;
  } else {
    cout << 1 << " " << 0 << endl;
  }
  return 0;
}
