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 SI = 2e5 + 100;
char dp[5005][505];
int pre_x[5005][505], pre_y[5005][505];
bool vis[5005][505];
int mod, s;
struct node {
  int sum, m;
};
void bfs() {
  queue<node> q;
  vis[0][0] = true;
  pre_x[0][0] = -1;
  pre_y[0][0] = -1;
  int news, newm;
  node ad, to;
  ad.sum = 0;
  ad.m = 0;
  q.push(ad);
  while (q.empty() == false) {
    ad = q.front();
    q.pop();
    for (int i = 0; i <= 9; i++) {
      if (i == 0 && ad.sum == 0) continue;
      news = ad.sum + i;
      newm = (ad.m * 10 + i) % mod;
      if (news > s) continue;
      if (vis[news][newm] == false) {
        vis[news][newm] = true;
        dp[news][newm] = i + '0';
        pre_x[news][newm] = ad.sum;
        pre_y[news][newm] = ad.m;
        to.sum = news;
        to.m = newm;
        q.push(to);
      }
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> mod >> s;
  bfs();
  string ans = "";
  if (vis[s][0]) {
    int x, y;
    x = s;
    y = 0;
    while (pre_x[x][y] != -1) {
      ans = dp[x][y] + ans;
      int nx = pre_x[x][y];
      int ny = pre_y[x][y];
      x = nx;
      y = ny;
    }
    cout << ans;
  } else
    cout << -1;
  return 0;
}