#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long q, a, qi = 1;
  cin >> q;
  for (int i = 1; i < k; i++) {
    cin >> a;
    if (n % a < n % q) {
      q = a;
      qi = i + 1;
    }
  }
  cout << qi << " " << n / q << endl;
  return 0;
}
int main1() {
  int n;
  scanf("%d)", &n);
  int qwerty[123456], q;
  for (int i = 1; i <= n; i++) {
    scanf("%d)", &q);
    qwerty[i] = q;
  }
  for (int i = 1; i <= n; i++) {
    if (qwerty[qwerty[qwerty[i]]] == i) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
