#include <bits/stdc++.h>
using namespace std;
int dp[10][101][905];
bool possible(int dig, int m, int s) {
  if (m < 0 || s < 0) return false;
  if (m == 1 && s == dig) return true;
  int &ret = dp[dig][m][s];
  if (ret != -1) return ret;
  for (int i = 0; i < 10; i++)
    if (possible(i, m - 1, s - dig)) return ret = 1;
  return ret = 0;
}
void printMin(int m, int s, bool start = false) {
  if (m == 0) return;
  int dig;
  for (dig = start ? 1 : 0; dig < 10; dig++)
    if (possible(dig, m, s)) {
      break;
    }
  if (dig < 10) {
    printf("%d", dig);
    printMin(m - 1, s - dig);
  } else
    printf("-1");
}
void printMax(int m, int s, bool start = false) {
  if (m == 0) return;
  int dig;
  for (dig = 9; dig >= (start ? 1 : 0); dig--)
    if (possible(dig, m, s)) break;
  if (dig >= (start ? 1 : 0)) {
    printf("%d", dig);
    printMax(m - 1, s - dig);
  } else
    printf("-1");
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  memset(dp, -1, sizeof(dp));
  int m, s;
  scanf("%d%d", &m, &s);
  if (s != 0) {
    printMin(m, s, true);
    printf(" ");
    printMax(m, s, true);
  } else {
    if (m == 1)
      printf("0 0");
    else
      printf("-1 -1");
  }
  return 0;
}
