#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int n, q, sz, nums[MAXN], pos[MAXN], l[MAXN], r[MAXN];
vector<int> lefts[MAXN];
vector<int> queries[MAXN];
long long ans[MAXN], ft[MAXN];
void update(int i, int val) {
  while (i < MAXN) {
    ft[i] += val;
    i += i & (-i);
  }
}
long long query(int i) {
  long long ac = 0LL;
  while (i) {
    ac += ft[i];
    i -= i & (-i);
  }
  return ac;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &nums[i]);
    pos[nums[i]] = i;
  }
  for (int i = 1, a, b; i <= n; ++i) {
    for (int j = i; j <= n; j += i) {
      a = pos[i];
      b = pos[j];
      if (a > b) swap(a, b);
      lefts[b].push_back(a);
    }
  }
  for (int i = 0; i < q; ++i) {
    scanf("%d%d", &l[i], &r[i]);
    queries[r[i]].push_back(i);
  }
  for (int i = 1; i < MAXN; ++i) {
    for (int j = 0; j < lefts[i].size(); ++j) update(lefts[i][j], 1);
    for (int j = 0, id; j < queries[i].size(); ++j) {
      id = queries[i][j];
      ans[id] = query(i) - query(l[id] - 1);
    }
  }
  for (int i = 0; i < q; ++i) cout << ans[i] << endl;
  return 0;
}
