#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int prime = 9241;
const long double pi = acos(-1.);
int a[200005];
int ra[200005];
vector<int> d[200005];
struct event {
  int x, l, r, t, qn;
  event() {}
  event(int x, int l, int r, int t, int qn) : x(x), l(l), r(r), t(t), qn(qn) {}
};
bool operator<(const event &a, const event &b) {
  if (a.x < b.x) return 1;
  if (a.x > b.x) return 0;
  return a.t < b.t;
}
event ev[5000005];
long long ans[200005];
const int C = 200005;
int fenw[C];
void inc(int i, int v) {
  i++;
  for (; i < C; i += -i & i) fenw[i] += v;
}
int sum(int i) {
  int ans = 0;
  i++;
  for (; i > 0; i &= i - 1) ans += fenw[i];
  return ans;
}
int sum(int l, int r) {
  int ans = -1;
  if (l == 0)
    ans = sum(r);
  else
    ans = sum(r) - sum(l - 1);
  return ans;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ra[a[i]] = i;
  }
  int ecnt = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j += i) {
      ev[ecnt++] = event(ra[i], ra[j], ra[j], 0, -1);
    }
  for (int i = 0; i < m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    ans[i] = 0;
    l--;
    r--;
    ev[ecnt++] = event(l, l, r, -1, i);
    ev[ecnt++] = event(r, l, r, 1, i);
  }
  sort(ev, ev + ecnt);
  for (int i = 0; i < ecnt; i++) {
    if (ev[i].t == 0) inc(ev[i].l, 1);
    if (ev[i].t == 1) ans[ev[i].qn] += (long long)sum(ev[i].l, ev[i].r);
    if (ev[i].t == -1) ans[ev[i].qn] -= (long long)sum(ev[i].l, ev[i].r);
  }
  for (int i = 0; i < m; i++) cout << ans[i] << "\n";
  return 0;
}
