Problem: You are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.

Input

The first line contains two positive integers d and s (1 ≤ d ≤ 500, 1 ≤ s ≤ 5000) separated by space.

Output

Print the required number or -1 if it doesn't exist.

Examples

Input

13 50


Output

699998


Input

61 2


Output

1000000000000000000000000000001


Input

15 50


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int M = 100001;
int n, m, x, y, d, s, a[M];
bool vis[510][5010];
pair<int, int> prv[510][5010];
queue<pair<int, int> > q;
void bfs() {
  while (!q.empty()) {
    int r = q.front().first;
    int sum = q.front().second;
    q.pop();
    if (sum == s && !r) {
      string s;
      pair<int, int> k = make_pair(r, sum);
      while (k.first != -1) {
        int t = prv[k.first][k.second].second;
        s += (k.second - t + '0');
        k = prv[k.first][k.second];
      }
      reverse(s.begin(), s.end());
      cout << s;
      exit(0);
    }
    for (int i = 0; i < 10; i++) {
      if (sum + i > s) break;
      int nsum = sum + i, nr = (r * 10 + i) % d;
      if (vis[nr][nsum]) continue;
      q.push(make_pair(nr, nsum));
      prv[nr][nsum] = make_pair(r, sum);
      vis[nr][nsum] = true;
    }
  }
  cout << -1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> d >> s;
  for (int i = 1; i <= 9; i++) {
    if (i % d == 0 && i == s) return cout << i, 0;
    if (i <= s) {
      q.push(make_pair(i % d, i));
      vis[i % d][i] = true;
      prv[i % d][i] = make_pair(-1, 0);
    }
  }
  bfs();
  return 0;
}