/*暴力搜索*/
#include <cstdio>
int c;//统计需要的spell的数量
int n;//spell的种类数
int m;//怪兽的血量
int spell[11][2];
void search(int b,int f[],int count,int m){
if(b<n&&m>0){
for(int i=0;i<n;i++){
if(f[i])continue;//如果spell已经使用找下一个spell
else{
count++;
f[i]=1;//记录为已使用
if(spell[i][1]>=m){
m-=spell[i][0]*2;
search(b+1,f,count,m);
m+=spell[i][0]*2;
}
else{
m-=spell[i][0];
search(b+1,f,count,m);
m+=spell[i][0];
}
f[i]=0;//恢复
count--;
}
}
}
else if(m<=0){//如果杀死了怪物
if(count<c)
c=count;//记录使用的spell数量
}
}
int main(){
int f[11];//记录spell的使用情况,0未使用,1已使用
//freopen("in.txt","r",stdin);
while(~scanf("%d%d",&n,&m)){
for(int i=0;i<n;i++){//输入数据
scanf("%d%d",&spell[i][0],&spell[i][1]);
f[i]=0;//初始化
}
c=11;
search(0,f,0,m);
//如果c没有改变表示不能杀死怪物
if(c==11)c=-1;
printf("%d\n",c);
}
}