#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long strToInt(string& a) {
  stringstream x(a);
  long long b;
  x >> b;
  return b;
}
void readI(long long& a) { cin >> a; }
void readI(long long& a, long long& b) { cin >> a >> b; }
void readI(long long& a, long long& b, long long& c) { cin >> a >> b >> c; }
vector<long long> readVI(long long n) {
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  return a;
}
vector<vector<long long> > readVVI(long long n, long long m) {
  vector<vector<long long> > a(n, vector<long long>(m));
  for (long long i = 0; i < n; i++) a[i] = readVI(m);
  return a;
}
vector<long long> readVLL(long long n) {
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  return a;
}
vector<vector<long long> > readVVLL(long long n, long long m) {
  vector<vector<long long> > a(n, vector<long long>(m));
  for (long long i = 0; i < n; i++) a[i] = readVLL(m);
  return a;
}
void print(vector<long long>& a) {
  for (auto el : a) {
    cout << el << ' ';
  }
  cout << '\n';
}
void print(vector<long long>& a, long long n) {
  long long cnt = 0;
  for (auto el : a) {
    if (cnt++ == n) break;
    cout << el << ' ';
  }
  cout << '\n';
}
const long long MOD = 1e9 + 7;
const long long INF = INT_MAX;
const long long INFF = INT64_MAX;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long moveX[] = {-1, 0, 1, 0};
const long long moveY[] = {0, 1, 0, -1};
void go() {
  long long n, m;
  cin >> n >> m;
  vector<long long> nums = readVI(m);
  long long ans = 0;
  for (long long i = 1; i < m; i++) {
    if (n % nums[i] < n % nums[ans]) ans = i;
  }
  cout << ans + 1 << ' ' << n / nums[ans] << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  while (T--) go();
  return 0;
}
