#include <bits/stdc++.h>
using namespace std;
template <class T>
class BIT {
  vector<T> tree;
  int mV;

 public:
  BIT() { mV = 0; }
  BIT(int size) {
    tree = vector<T>(size + 1);
    mV = size;
  }
  inline void resize(int size) {
    tree.clear();
    tree = vector<T>(size + 1);
    mV = size;
  }
  inline void upd(int idx, T v = 1) {
    v %= 1000000007;
    while (idx <= mV) {
      tree[idx] += v;
      tree[idx] %= 1000000007;
      idx += idx & -idx;
    }
  }
  inline T get(int idx) {
    if (idx <= 0) return 0;
    T ret = 0;
    while (idx) {
      ret += tree[idx];
      ret %= 1000000007;
      idx -= idx & -idx;
    }
    return ret;
  }
  inline T getS(int idx) {
    T ret = tree[idx];
    if (idx) {
      int z = idx - (idx & -idx);
      idx--;
      while (idx != z) {
        ret -= tree[idx];
        idx -= idx & -idx;
      }
    }
    return ret;
  }
};
int mark[200000];
void failure(char *p, int *F, int M) {
  F[0] = F[1] = 0;
  for (int i = 2; i <= M; i++) {
    int j = F[i - 1];
    for (;;) {
      if (p[j] == p[i - 1]) {
        F[i] = j + 1;
        break;
      }
      if (j == 0) {
        F[i] = 0;
        break;
      }
      j = F[j];
    }
  }
}
int kmp(char *text, char *pat, int *F, int N, int M) {
  failure(pat, F, M);
  int i = 0, j = 0, ret = 0;
  for (;;) {
    if (j == N) break;
    if (text[j] == pat[i]) {
      i++, j++;
      if (i == M) {
        mark[j - M] = j - 1;
        ret++;
      }
    } else if (i > 0)
      i = F[i];
    else
      j++;
  }
  return ret;
}
char s[200000], t[200000];
int F[200000];
BIT<long long> bit(200000);
int dp[200000], sum[200000];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s >> t;
  memset((mark), (-1), sizeof(mark));
  ;
  int N = strlen(s);
  int M = strlen(t);
  kmp(s, t, F, N, M);
  for (int i = N - 1; i >= 0; i--) {
    if (mark[i] == -1) mark[i] = mark[i + 1];
    if (mark[i] == -1) continue;
    int nxt = mark[i];
    nxt++;
    long long now = bit.get(N + 1);
    now -= bit.get(nxt);
    if (now < 0) now += 1000000007;
    now += max(N - nxt + 1, 0);
    now %= 1000000007;
    sum[i] = now;
    sum[i] += sum[i + 1];
    sum[i] %= 1000000007;
    bit.upd(i + 1, sum[i]);
  }
  cout << sum[0] << endl;
  return 0;
}
