#include <bits/stdc++.h>
using namespace std;
struct hamster {
  long long size;
  int number;
  long long i;
};
bool cmp(hamster &h1, hamster &h2) { return h1.size < h2.size; }
int main() {
  ios::sync_with_stdio(false);
  int i = 1;
  long long n;
  int k;
  int min_i = 0;
  int min = 0;
  cin >> n >> k;
  hamster *p = new hamster[k];
  for (int i = 0; i < k; i++) {
    cin >> p[i].size;
    p[i].number = i + 1;
  }
  sort(p, p + k, cmp);
  for (int i = 0; i < k; i++) {
    p[i].i = p[i].size;
    p[i].size = n % p[i].size;
  }
  sort(p, p + k, cmp);
  cout << p[0].number << " " << n / p[0].i << endl;
  return 0;
}
