#include <bits/stdc++.h>
using namespace std;
long long dp[100005], ans[100005];
struct nodes {
  int link, len;
  bool inMain;
  map<int, int> next;
  set<int> child;
} st[2 * 100005 + 1];
struct SA {
  int sz, last;
  void init() {
    st[0].link = -1;
    st[0].len = 0;
    sz = 1;
    last = 0;
    st[0].inMain = true;
  }
  void add_char(char c) {
    int curr = sz++;
    st[curr].len = st[last].len + 1;
    st[curr].inMain = true;
    int p;
    for (p = last; p != -1 && st[p].next.count(c) == 0; p = st[p].link) {
      st[p].next[c] = curr;
    }
    if (p == -1) {
      st[curr].link = 0;
      st[0].child.insert(curr);
    } else {
      int q = st[p].next[c];
      if (st[p].len + 1 == st[q].len) {
        st[curr].link = q;
        st[q].child.insert(curr);
      } else {
        int clone = sz++;
        st[clone].inMain = false;
        st[clone].len = st[p].len + 1;
        st[clone].link = st[q].link;
        st[clone].next = st[q].next;
        st[st[q].link].child.insert(clone);
        st[st[q].link].child.erase(q);
        for (; p != -1 && st[p].next[c] == q; p = st[p].link)
          st[p].next[c] = clone;
        st[q].link = st[curr].link = clone;
        st[clone].child.insert(q);
        st[clone].child.insert(curr);
      }
    }
    last = curr;
  }
  int get_state(char* s) {
    int i = 0, q = 0, l = strlen(s);
    while (i != l) {
      if (!st[q].next.count(*(s + i))) return -1;
      q = st[q].next[*(s + i)];
      i++;
    }
    return q;
  }
  vector<int> occur;
  bitset<100005> bt;
  void occur_dfs(int q) {
    if (st[q].inMain) {
      bt[st[q].len - 1] = 1;
      occur.push_back(st[q].len - 1);
    }
    set<int>::iterator it, itE = st[q].child.end();
    for (it = st[q].child.begin(); it != itE; it++) {
      occur_dfs(*it);
    }
    return;
  }
  void all_occur(char* s) {
    int q = get_state(s);
    bt.reset();
    if (q == -1) return;
    occur_dfs(q);
    return;
  }
};
char s[100005], t[100005];
int main() {
  scanf("%s %s", s, t);
  int j = -1, i, n, ls = strlen(s), lt = strlen(t);
  SA sa;
  sa.init();
  for (i = 0; i < ls; i++) sa.add_char(s[i]);
  sa.all_occur(t);
  memset(dp, 0, sizeof(dp));
  memset(ans, 0, sizeof(ans));
  for (i = ls - 1; i >= 0; --i) {
    if (sa.bt[i] == 1) {
      j = i;
      break;
    }
    dp[i] = ans[i] = 0;
  }
  if (j == -1) {
    cout << 0 << endl;
    return 0;
  }
  dp[j - lt + 1] = ans[j - lt + 1] = (ls - j);
  int prev, curr;
  prev = j;
  curr = j;
  for (i = j - lt; i >= 0; --i) {
    dp[i] = dp[i + 1] % 1000000007;
    if (sa.bt[i + lt - 1] == 1) {
      curr = i + lt - 1;
      dp[i] =
          (dp[i] + ((prev - curr) * (ans[prev] + 1)) % 1000000007) % 1000000007;
      long long s = 0;
      for (int k = curr + 1; k < prev; k++) {
        s = (s + ((k - curr) * dp[k]) % 1000000007) % 1000000007;
      }
      dp[i] = (dp[i] + s) % 1000000007;
      prev = curr;
    }
    ans[i] = (ans[i + 1] + dp[i]) % 1000000007;
  }
  cout << ans[0] << endl;
  return 0;
}
