#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long INF = 4e18;
const int inf = 2e9;
const double eps = 1e-13;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int main(void) {
  int m, s, i, j;
  scanf("%d %d", &m, &s);
  if ((m > 1 && s == 0) || s > 9 * m) {
    puts("-1 -1");
    return 0;
  }
  if (m == 1 && s == 0) {
    puts("0 0");
    return 0;
  }
  int now = s;
  int ans = max(1, now - 9 * (m - 1));
  printf("%d", ans);
  now -= ans;
  for (i = m - 2; i >= 0; --i) {
    ans = max(0, now - 9 * i);
    printf("%d", ans);
    now -= ans;
  }
  printf(" ");
  now = s;
  for (i = 0; i < m; ++i) {
    ans = min(9, now);
    printf("%d", ans);
    now -= ans;
  }
  printf("\n");
  return 0;
}
