#include <bits/stdc++.h>
using namespace std;
void getio();
void solve() {
  long long m, s;
  cin >> m >> s;
  if (m == 1 and s == 0) {
    cout << "0 0";
    return;
  }
  if (!s) {
    cout << "-1 -1";
    return;
  }
  std::vector<long long> ans;
  long long i = 9;
  long long use = 0;
  while (use != s and i != 0) {
    if (use + i > s)
      i--;
    else {
      use += i;
      ans.push_back(i);
    }
    if (ans.size() > m) {
      cout << "-1 -1" << endl;
      return;
    }
  }
  long long zero = 0;
  while (ans.size() != m) {
    zero++;
    ans.push_back(0);
  }
  if (use == s) {
    std::vector<long long> one = ans;
    reverse(one.begin(), one.end());
    for (long long i = 0; i < m; i++)
      if (one[i]) {
        one[i] -= 1;
        break;
      }
    one[0] += 1;
    for (long long i = 0; i < m; i++) cout << one[i];
    cout << ' ';
    for (long long i = 0; i < m; i++) cout << ans[i];
  } else
    cout << "-1 -1";
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  getio();
  solve();
}
void getio() {}
