I have two files both with millions of records in (not the same amount of records in each)

File A 

```
46901208,(SPUR OFF) FFERM LLIDIART WERDD,WRECSAM
85315934,A4077 FROM CRUGHYWEL ROAD,CRUGHYWEL
46402576,A4085 COFNOD WEDI CAU,BEDDGELERT
46400001,A4085 CYLCHFAN CAEATHRO,CAEATHRO

```

File B

```
46408008,1
46400005,1
46400001,4
46402576,3

```

I want to merge the two files based on matching $1, the ones that don't match I don't want them being output. 

Desired output:

```
46402576,A4085 COFNOD WEDI CAU,BEDDGELERT,3
46400001,A4085 CYLCHFAN CAEATHRO,CAEATHRO,4

```

How can I do this? 
Thanks