#include <bits/stdc++.h>
using namespace std;
int64_t pow_mod(int64_t x, int64_t y) {
  int64_t ans = 1;
  while (y > 0) {
    if (y & 1) ans = (ans * x) % (int64_t)(1e9 + 7);
    y = y / 2;
    x = (x * x) % (int64_t)(1e9 + 7);
  }
  return ans;
}
bool isprime(int64_t n) {
  bool flag = true;
  for (int64_t i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
int64_t binarySearch(int64_t key, vector<int64_t>& arr) {
  int64_t n = arr.size();
  int64_t l = 0, h = n - 1;
  int64_t mid;
  while (l <= h) {
    mid = (l + h) / 2;
    if (arr[mid] == key)
      return mid;
    else if (key < arr[mid])
      h = mid - 1;
    else
      l = mid + 1;
  }
  return -1;
}
vector<bool> sieve(int64_t n) {
  vector<bool> arr(n + 1, 1);
  for (int64_t i = 2; i * i <= n; i++) {
    if (arr[i] == 1)
      for (int64_t j = i * i; j <= n; j += i) {
        arr[j] = 0;
      }
  }
  arr[0] = 0;
  arr[1] = 0;
  return arr;
}
bool comp(long double a, int64_t b) { return a < b; }
void solve() {
  int64_t m, s;
  cin >> m >> s;
  if (m == 1 and s <= 9) {
    cout << s << " " << s;
    return;
  }
  if (s > 9 * m or s == 0) {
    cout << -1 << " " << -1;
    return;
  }
  vector<int64_t> large(m);
  vector<int64_t> smol(m);
  int64_t sum = s;
  for (auto i = 0; i < m; i++) {
    if (sum >= 9) {
      large[i] = 9;
    } else {
      large[i] = sum;
    }
    sum -= large[i];
  }
  sum = s;
  smol[0] = 1;
  sum--;
  for (int64_t i = m - 1; i >= 0; i--) {
    if (sum >= 9) {
      smol[i] += 9;
    } else
      smol[i] += sum;
    sum -= smol[i];
  }
  for (auto i : smol) cout << i;
  cout << " ";
  for (auto i : large) cout << i;
  cout << "\n";
  return;
}
signed main() {
  int64_t t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
