#include <bits/stdc++.h>
using namespace std;
int main() {
  int x = 0, maxi, mini, sh[100009], dp[100009], m, s;
  string t, b;
  cin >> m >> s;
  dp[0] = s;
  for (int i = 0; i < m; i++) {
    if (dp[i] == 0) break;
    sh[i] = min(dp[i], 9);
    if (dp[i] > 9)
      dp[i + 1] = dp[i] - 9;
    else
      dp[i + 1] = 0;
  }
  if (dp[m - 1] - 9 > 0)
    cout << "-1 -1";
  else if (dp[0] == 0 && m == 1)
    cout << "0 0";
  else if (dp[0] == 0)
    cout << "-1 -1";
  else {
    for (int i = 0; i < m; i++) b += (char)(sh[i] + 48);
    for (int i = m - 1; i >= 0; i--) t += (char)(sh[i] + 48);
    if (t[0] == '0') {
      t[0] = '1';
      for (int i = 1; i < m; i++) {
        if (t[i] == '0')
          x++;
        else
          break;
      }
      t[x + 1] = (char)(sh[m - 2 - x] + 47);
    }
  }
  cout << t << " " << b;
  return 0;
}
