#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int BS = 5;
int n, m;
int a[N];
int p[N], ps[N];
int l[N], r[N];
int idx[N];
long long ans[N];
long long u[N];
vector<pair<int, int> > v;
int cmp(int a, int b) { return l[a] < l[b] || l[a] == l[b] && r[a] < r[b]; }
void modify(int x, long long v) {
  for (x += BS; x < N; x += x & -x) u[x] += v;
}
long long getsum(int x) {
  long long s = 0;
  for (x += BS; x; x -= x & -x) s += u[x];
  return s;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", p + i);
    ps[p[i]] = i;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; j += i) {
      int x = ps[i], y = ps[j];
      if (x > y) swap(x, y);
      v.push_back(make_pair(x, y));
      a[y]++;
    }
  }
  sort(v.begin(), v.end());
  for (int i = 1; i <= n; ++i) {
    modify(i, a[i]);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", l + i, r + i);
  }
  for (int i = 0; i < m; ++i) {
    idx[i] = i;
  }
  sort(idx, idx + m, cmp);
  int j = 0;
  for (int i = 0; i < m; ++i) {
    int ii = idx[i];
    for (; j < v.size(); ++j) {
      if (v[j].first < l[ii]) {
        modify(v[j].second, -1);
      } else {
        break;
      }
    }
    ans[ii] = getsum(r[ii]);
  }
  for (int i = 0; i < m; ++i) {
    printf("%lld\n", ans[i]);
  }
  return 0;
}
