#include <bits/stdc++.h>
using namespace std;
const long long prime = 1e9 + 7;
const long long maxN = 1e5 + 5;
const long double pi = 3.1415926536;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k, a, rem = 1e18, t = 1, b = 0;
  cin >> n >> k;
  for (long long i = (long long)(1); i <= (long long)(k); i++) {
    cin >> a;
    if ((a <= n) && (n % a < rem)) {
      rem = n % a;
      t = i;
      b = n / a;
    }
  }
  cout << t << " " << b;
  return 0;
}
