#include <bits/stdc++.h>
using namespace std;
template <class T>
T expo(T base, T exp, T mod) {
  T res = 1;
  base = base % mod;
  while (exp > 0) {
    if (exp & 1) res = (res * base) % mod;
    exp = exp >> 1;
    base = (base * base) % mod;
  }
  return res;
}
void input(vector<long long> &arr) {
  for (long long i = 0; i < arr.size(); i++) cin >> arr[i];
}
void output(vector<long long> &arr) {
  for (long long i = 0; i < arr.size(); i++) cout << arr[i] << " ";
  cout << endl;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void print(vector<vector<char> > arr, long long n, long long m) {
  cout << "yes" << endl;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cout << arr[i][j];
    }
    cout << endl;
  }
}
bool check(long long x, long long d) {
  long long sum = (x * (x + 1)) / 2;
  if (sum < d) return false;
  return sum % 2 == d % 2;
}
long long cal(long long src, vector<long long> arr[], vector<long long> &dp) {
  if (dp[src] != -1) return dp[src];
  long long ans = 0;
  for (long long x : arr[src]) {
    ans = max(cal(x, arr, dp) + 1, ans);
  }
  return dp[src] = ans;
}
long long mi = INT_MAX;
long long m2 = INT_MIN;
void mak(long long sum, long long n, long long m) {
  if (n == 0 && m == 0) {
    mi = min(mi, sum);
    m2 = max(m2, sum);
    return;
  }
  if (n == 0) return;
  for (long long d = 9; d >= 0; d--) {
    if (m - d >= 0) {
      long long t = sum * 10 + d;
      mak(t, n - 1, m - d);
    }
  }
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long sum = m;
  if (n == 1 && m == 0) {
    cout << 0 << " " << 0;
    return;
  }
  long long sm = 1;
  long long max = n * 9;
  if (sm <= m && max >= m) {
    string k = "";
    for (long long i = 1; i <= n; i++) {
      for (long long d = 9; d >= 0; d--) {
        if (m - d >= 0) {
          m = m - d;
          k += to_string(d);
          break;
        }
      }
    }
    string s = k;
    reverse(s.begin(), s.end());
    if (s[0] == '0') {
      for (long long i = 1; i < n; i++) {
        if (s[i] != '0') {
          long long t = s[i] - '0';
          s[i] = (t - 1) + '0';
          s[0] = '1';
          break;
        }
      }
    }
    cout << s << " " << k;
  } else
    cout << "-1 "
         << "-1";
}
int32_t main() {
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
}
