#include <bits/stdc++.h>
using namespace std;
namespace stuff {
const int MOD = 1000000007;
const int MAX = 111000;
int pre[MAX];
long long bit[MAX];
void update(int pos, long long val) {
  for (int i = pos + 2; i < MAX; i += i & -i) bit[i] = (bit[i] + val) % MOD;
}
long long get(int pos) {
  long long res = 0;
  for (int i = pos + 2; i > 0; i -= i & -i) res = (res + bit[i]) % MOD;
  return res;
}
void solve(int test_num) {
  string str, key;
  cin >> str >> key;
  pre[0] = -1;
  for (int i = 0, j = -1; i < (int)key.size(); i++) {
    while (~j && key[j] != key[i]) j = pre[j];
    pre[i + 1] = ++j;
  }
  memset(bit, 0, sizeof(bit));
  for (int i = 0, j = 0, last_st = -1; i < (int)str.size(); i++) {
    while (~j && key[j] != str[i]) j = pre[j];
    if (++j == (int)key.size()) {
      last_st = i - key.size() + 1;
      j = pre[j];
    }
    if (last_st != -1) {
      const long long now = (last_st + 1 + get(last_st - 1)) % MOD;
      update(i, now);
    }
    update(i, (get(i - 1) - get(i - 2) + MOD) % MOD);
  }
  const long long res = (get(str.size() - 1) - get(str.size() - 2) + MOD) % MOD;
  cout << res << endl;
}
void solve() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  for (int t = 1; t <= T; t++) solve(t);
}
}  // namespace stuff
int main() {
  stuff::solve();
  return 0;
}
