#include <bits/stdc++.h>
using namespace std;
struct BinaryIndexedTree {
  long long c[210000], n;
  inline void init() { memset(c, 0, sizeof(c)); }
  inline int lowbit(int x) { return x & -x; }
  inline void update(int x, int k) {
    while (x <= n) {
      c[x] += k;
      x += lowbit(x);
    }
  }
  inline long long getsum(int x) {
    long long ans = 0;
    while (x > 0) {
      ans += c[x];
      x -= lowbit(x);
    }
    return ans;
  }
} BIT;
struct query {
  int l, r, id;
} q1[210000], q2[210000];
int n, m, a[210000], pos[210000];
long long ans[210000];
bool cmp1(query a, query b) { return a.l == b.l ? a.r < b.r : a.l < b.l; }
bool cmp2(query a, query b) { return a.r == b.r ? a.l < b.l : a.r < b.r; }
int main() {
  while (~scanf("%d%d", &n, &m)) {
    BIT.n = n;
    BIT.init();
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      pos[a[i]] = i;
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d%d", &q1[i].l, &q1[i].r);
      q2[i] = q1[i];
      q1[i].id = q2[i].id = i;
    }
    int i, j, k;
    sort(q1 + 1, q1 + 1 + m, cmp1);
    sort(q2 + 1, q2 + 1 + m, cmp2);
    for (i = 1, j = 1, k = 1; i <= n; i++) {
      for (; q1[j].l == i && j <= m; j++)
        ans[q1[j].id] -= BIT.getsum(q1[j].r) - BIT.getsum(q1[j].l - 1);
      for (int p = 1; a[i] * p <= n; p++) BIT.update(pos[a[i] * p], 1);
      for (; q2[k].r == i && k <= m; k++)
        ans[q2[k].id] += BIT.getsum(q2[k].r) - BIT.getsum(q2[k].l - 1);
    }
    for (int i = 1; i <= m; i++) printf("%I64d\n", ans[i]);
  }
  return 0;
}
